package com.prim.update.model;

import java.io.Serializable;

/**
 * ================================================
 * 作    者：linksus
 * 版    本：1.0
 * 创建日期：3/5 0005
 * 描    述：如需要其他字段在此类中添加或修改
 * 修订历史：
 * ================================================
 */
public class UpdateInfo implements Serializable {
    private String message;                             // 消息
    private String fake_id;                             // 用户假id
    private String is_needs_update;                     // 1-需要更新 2-强制更新 0-无需更新
    private String down_load_url;                       // apk下载地址
    private String down_patch_url;                      // patch下载地址
    private String is_patch;                            // 0-不启用增量跟新 1-启用增量更新
    private String version_name;                        // 版本名称
    private String version_code;                        // 版本号
    private int time = 0;                                   // 时间周期
    private String server_time;                         // 时间周期

    public UpdateInfo() {

    }

    public boolean isEnforce() {
        return is_needs_update.equals("2");
    }

    public boolean isNoUpdate() {
        return is_needs_update.equals("0");
    }

    public boolean isPatch() {
        return is_patch.equals("1");
    }

    public String getDownloadUrl() {
        if (isPatch()) {
            return down_patch_url;
        } else {
            return down_load_url;
        }
    }

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        this.time = time;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getIs_needs_update() {
        return is_needs_update;
    }

    public void setIs_needs_update(String is_needs_update) {
        this.is_needs_update = is_needs_update;
    }

    public String getDown_load_url() {
        return down_load_url;
    }

    public void setDown_load_url(String down_load_url) {
        this.down_load_url = down_load_url;
    }

    public String getDown_patch_url() {
        return down_patch_url;
    }

    public void setDown_patch_url(String down_patch_url) {
        this.down_patch_url = down_patch_url;
    }

    public String getIs_patch() {
        return is_patch;
    }

    public void setIs_patch(String is_patch) {
        this.is_patch = is_patch;
    }

    public String getVersion_name() {
        return version_name;
    }

    public void setVersion_name(String version_name) {
        this.version_name = version_name;
    }

    public String getVersion_code() {
        return version_code;
    }

    public void setVersion_code(String version_code) {
        this.version_code = version_code;
    }

    public String getServer_time() {
        return server_time;
    }

    public void setServer_time(String server_time) {
        this.server_time = server_time;
    }

    public String getFake_id() {
        return fake_id;
    }

    public void setFake_id(String fake_id) {
        this.fake_id = fake_id;
    }

    @Override
    public String toString() {
        return "UpdateInfo{" +
                "message='" + message + '\'' +
                ", fake_id='" + fake_id + '\'' +
                ", is_needs_update='" + is_needs_update + '\'' +
                ", down_load_url='" + down_load_url + '\'' +
                ", down_patch_url='" + down_patch_url + '\'' +
                ", is_patch='" + is_patch + '\'' +
                ", version_name='" + version_name + '\'' +
                ", version_code='" + version_code + '\'' +
                ", time=" + time +
                ", server_time='" + server_time + '\'' +
                '}';
    }
}
